import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @description:
 * @Author yyp
 * @time
 */
public class Api_ {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress host1 = InetAddress.getLocalHost();
        System.out.println(host1);
//        InetAddress host2 = InetAddress.getByName("ThinkPad-PC");
//        System.out.println(host2);
        InetAddress host3 = InetAddress.getByName("www.baidu.com");
        System.out.println(host3);
        String host3Name = host3.getHostName();
        System.out.println(host3Name);
        String host3Address = host3.getHostAddress();
        System.out.println(host3Address);
    }

}
